#pragma once
#include "SevenZipInterfaces.h"

namespace SevenZip
{
struct CSevenZipStream : CComObjectRootEx<CComSingleThreadModel>,
                         ISequentialOutStream,
						 IInStream
{
	DECLARE_NOT_AGGREGATABLE(CSevenZipStream)

	BEGIN_COM_MAP(CSevenZipStream)
		COM_INTERFACE_ENTRY(IInStream)
		COM_INTERFACE_ENTRY(ISequentialOutStream)
	END_COM_MAP()

	STDMETHODIMP Initialize(const CComPtrBase<IStream> &);

	// ISequentialOutStream
	IFACEMETHODIMP Write(__in LPCVOID, UINT32, __out PUINT32);

	// IInStream
	IFACEMETHODIMP Read(__out_bcount_part(Count, *Read) PVOID, UINT32 Count, __out PUINT32 Read);
	IFACEMETHODIMP Seek(INT64, UINT32, __out PUINT64);

private:
	CComPtr<IStream> _Inner;
};
}